package br.com.center.loja.mb.utils;

import javax.faces.application.FacesMessage;
import javax.faces.context.FacesContext;

public class FacesUtils {
	
	public static void errorMessage(Exception exception){
		FacesMessage message = 
				new FacesMessage(FacesMessage.SEVERITY_ERROR, 
								 exception.getLocalizedMessage(), 
								 exception.getLocalizedMessage());
		
		FacesContext.getCurrentInstance().addMessage(null, message);
	}
	
	public static void errorMessage(String content){
		FacesMessage message = 
				new FacesMessage(FacesMessage.SEVERITY_ERROR, 
								 content, content);
		
		FacesContext.getCurrentInstance().addMessage(null, message);
	}
	
	public static void message(String content){
		FacesMessage message = 
				new FacesMessage(FacesMessage.SEVERITY_INFO, 
						content, content);
		
		FacesContext.getCurrentInstance().addMessage(null, message);
	}
	
	

}
